#define _CRT_SECURE_NO_WARNINGS 520
#include<stdio.h>

int main()
{
	int arr[] = { 1,2,3,4,5,0,0,0,0,0,0 };

	int m = 0, n = 0;
	for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++)
	{
		if (*(arr + i) != 0)
		{
			m++;
		}
	}
	int arr2[] = { 1,2,6,7,8,9 };
	for (int i = 0; i < sizeof(arr2) / sizeof(arr2[0]);i++)
	{
		n++;
	}
	int* L1 = arr + m - 1;
	int* L2 = arr2 + n - 1;
	int* L3 = arr + m + n - 1;
	while (L1 >= arr && L2 >= arr2)
	{
		if (*L1 > *L2)
		{
			*L3-- = *L1--;
		}
		else
			*L3-- = *L2--;
	}
	while (L2 >= arr2)
	{
		*L3-- = *L2--;
	}
	for (int i = 0; i < m + n; i++)
	{
		printf("%d", *(arr + i));
	}
	return 0;
}